Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drawing editor mode #132

Merged
merged 63 commits into from
Aug 14, 2023
Merged

Drawing editor mode #132

merged 63 commits into from
Aug 14, 2023

Conversation

luca-della-vedova
Copy link
Member

@luca-della-vedova luca-della-vedova commented May 25, 2023

New feature implementation

Implemented feature

Addresses #117.

Implementation description

This PR makes progress implements fully featured editing of drawing and layers, as well as alignment.

Fiducials and constraints

Parsing and rendering of fiducials and constraints has been added. They will be used for both intra-level alignment (fiducials on different drawings connected through constraints) as well as inter-level alignment (fiducials on different levels connected through constraints).
Fiducials have been added to Site and Level to serialize and deserialize this data. Levels also have a Constraints variable for intra-level alignment between different drawings (i.e. for robot maps) while site-wide constraints are inferred between equally named fiducials.

Hierarchy for drawings

Measurements and fiducials are now children of drawings, which means their relative position will be preserved when the drawings are transformed. They are also in pixel coordinates.

Robot layers

Robot layers in the building.yaml format are now parsed and added as drawings when a project is imported.
An additional component has been added to denote whether a drawing is "Primary" or not. Legacy drawings are set as Primary and robot layers are not. The idea is that when solving the optimization problem for map alignment, the primary ground truth drawings will be kept as static and only the non primary ones will be transformed.

Category visibility widget

A new top bar menu View has been added, users can display or hide certain categories of entities through a checkbox. Starts to be useful since with fiducials, constraints and multiple drawings the view can become a bit cluttered.
It also provided an easy way to switch to different modes such as site and drawing editor, since we can quickly hide a category of entities that are not relevant for the specific mode.

Drawing editor mode

A new button has been added to the inspector widget when a drawing is selected to enter the new Drawing Editor mode.
Upon entering drawing editor mode:

  • All the entities except the current drawing and its children will be hidden.
  • The Create widget will only allow spawning fiducials and measurements, which will be made children of the current drawing in pixel coordinates upon spawning.
  • A button in the drawing inspector will be shown to scale the drawing. When clicking automatic scaling will be performed. For now this is only a basic scaling based on measurements' pixel distance related to their Distance (that is now also shown, rather than hidden as it was before).

Still pending

The following are currently missing to have a fully functional editor. Based on time they might either go in this PR or go in a followup to avoid this becoming even larger than it currently is.

  • Transparency for drawings: There is a FloorVisibility component and UI widget to change the transparency of floors but it doesn't apply to drawings so it's not possible to make them transparent. There is a TODO in place to make the component generic but it's not been implemented yet. e162a7b makes the component generic and adds it to drawings. By default primary drawings are fully opaque while secondary drawings are partially transparent.
  • Intra-level alignment: Aligning all non primary drawings to primary drawings and calculating their transform parameters, these will be the ones used by fleet adapters to transform between RMF and robot coordinates. fd0cb9e adds alignment based on fiducials, using the optimization-engine crate.
  • Multi-level display: To visualize multi-level constraints between fiducials and verify that alignment worked correctly it would be great if there was a way to display multiple levels. 70587a7 implements a 3d view with all the levels, with interaction disabled, to allow the whole building and verifying level alignment.
  • Multi-level alignment: While alignment is performed on import of legacy projects, there is no way to do it at runtime on sites. 4a65c71 introduces alignment between floors, based on the optimization-engine crate.
  • Making the UX for constraints bulletproof: Right now constraint creation goes through the same code path as other edges, while what it should really do is only allow connecting fiducials from different drawings / levels to each other. This might take some refactoring at how select_anchor works, since the functionality is not complete we could remove the spawn constraint button for now. c1681dc forces constraints to only be drawn between fiducials and only between different drawings.
  • Creating a UX for multilevel constraints, since right now there is no way to spawn them. Previously they were done through manual naming of fiducials, now they are drawn (but drawing in the 3d multilevel view is not very intuitive). With e807007 they are now managed the same way as legacy traffic editor, spawned and despawned when labels are changed.

Signed-off-by: Luca Della Vedova <[email protected]>
Signed-off-by: Luca Della Vedova <[email protected]>
Signed-off-by: Luca Della Vedova <[email protected]>
Signed-off-by: Luca Della Vedova <[email protected]>
Signed-off-by: Luca Della Vedova <[email protected]>
Signed-off-by: Luca Della Vedova <[email protected]>
Signed-off-by: Luca Della Vedova <[email protected]>
Signed-off-by: Luca Della Vedova <[email protected]>
Signed-off-by: Luca Della Vedova <[email protected]>
Signed-off-by: Luca Della Vedova <[email protected]>
Signed-off-by: Luca Della Vedova <[email protected]>
Signed-off-by: Luca Della Vedova <[email protected]>
Signed-off-by: Luca Della Vedova <[email protected]>
@luca-della-vedova luca-della-vedova linked an issue Jun 14, 2023 that may be closed by this pull request
@luca-della-vedova
Copy link
Member Author

There is currently a different user experience for matching fiducials between different levels (for inter-level alignment) and different drawings on the same level (for robot - main drawing alignment).

Inter level uses fiducial names as in traffic editor, while intra level are matched by drawing constraints, also like traffic editor. Drawing of constraints is quite tricky and required a fair bit of additional logic in select_anchor to make sure that they can only be drawn between different drawings. If we adopted the same logic based on fiducial names the code path there could be greatly simplified, and we would also be able to remove the need to serialize constraints since they are auto-determined, but not sure that is the best way forward (drawing is still quite useful visually).

@mxgrey mxgrey merged commit e45f497 into main Aug 14, 2023
5 checks passed
@mxgrey mxgrey deleted the luca/drawing_editor branch August 14, 2023 09:36
@audrow
Copy link
Contributor

audrow commented Aug 21, 2023

From using git bisect it seems like this PR somehow removes the "Export URDF" option for workcells, or maybe I'm missing something. @luca-della-vedova, any thoughts on why this might be?

@mxgrey
Copy link
Collaborator

mxgrey commented Aug 22, 2023

There were a lot of merge conflicts to deal with by the time this PR was being merged. Most likely it got wiped out while I was attempting to resolve conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Measurements and Fiducials should be children of Drawings
3 participants